﻿Public Class IntellisSencePopUp

    Friend Property SelectedItem As TreeNodes
        Get
            Return lbxIntelliSence.SelectedItem
        End Get
        Set(value As TreeNodes)
            lbxIntelliSence.SelectedItem = value
        End Set
    End Property

    Friend Property SelectedIndex As Integer
        Get
            Return lbxIntelliSence.SelectedIndex
        End Get
        Set(value As Integer)
            If (value >= lbxIntelliSence.Items.Count) OrElse
                (value < -1) Then Return
            lbxIntelliSence.SelectedIndex = value
            lbxIntelliSence.ScrollIntoView(lbxIntelliSence.SelectedItem)
        End Set
    End Property

    Friend ReadOnly Property ItemsCount As Integer
        Get
            Return lbxIntelliSence.Items.Count
        End Get
    End Property

    Friend Event ListBoxKeyDown(ByVal sender As Object, ByVal e As KeyEventArgs)
    Friend Event ListBoxItemDoubleClick(ByVal sender As Object, ByVal e As MouseButtonEventArgs)

    Protected Overridable Sub OnListBoxItemDoubleClick(ByVal sender As Object, ByVal e As MouseButtonEventArgs)
        RaiseEvent ListBoxItemDoubleClick(sender, e)
    End Sub

    Protected Overridable Sub OnListBoxPrevieKeyDown(ByVal sender As Object, ByVal e As KeyEventArgs)
        RaiseEvent ListBoxKeyDown(sender, e)
    End Sub

End Class
